
GCC = gcc

all: mainc maincpp maincpp2

# c代码加载c库
mainc: lib
	$(GCC) -Wall -o outc main.c -ldl

# c++代码加载c++库
maincpp: libcpp
	$(GCC) -Wall -o outcpp main.cpp -ldl -lstdc++

# c++代码加载类库
maincpp2: libcpp2
	$(GCC) -Wall -o outcpp2 main2.cpp -ldl -lstdc++

lib:
	$(GCC) -Wall -fPIC -shared -o libtest.so test.c

libcpp:
	$(GCC) -Wall -fPIC -shared -o libtestcpp.so test.cpp -lstdc++

libcpp2:
	$(GCC) -Wall -fPIC -shared -o libtestcpp2.so test2.cpp -lstdc++

clean:
	rm -rf out* libtest*
